package o;

import android.content.Context;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.ViewConfiguration;

class blv$b extends blv {
    private VelocityTracker ʻ;
    final float ˊ;
    float ˋ;
    float ˎ;
    final float ˏ;
    private boolean ॱॱ;

    public blv$b(Context context) {
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        this.ˊ = (float) viewConfiguration.getScaledMinimumFlingVelocity();
        this.ˏ = (float) viewConfiguration.getScaledTouchSlop();
    }

    float ॱ(MotionEvent motionEvent) {
        return motionEvent.getX();
    }

    float ˊ(MotionEvent motionEvent) {
        return motionEvent.getY();
    }

    public boolean ˏ() {
        return false;
    }

    public boolean ˏ(MotionEvent motionEvent) {
        switch (motionEvent.getAction()) {
            case 0:
                ʻ(motionEvent);
                break;
            case 1:
                ˋ(motionEvent);
                break;
            case 2:
                ˎ(motionEvent);
                break;
            case 3:
                ˎ();
                break;
        }
        return true;
    }

    private void ˋ(MotionEvent motionEvent) {
        if (this.ॱॱ && this.ʻ != null) {
            this.ˋ = ॱ(motionEvent);
            this.ˎ = ˊ(motionEvent);
            this.ʻ.addMovement(motionEvent);
            this.ʻ.computeCurrentVelocity(1000);
            float xVelocity = this.ʻ.getXVelocity();
            float yVelocity = this.ʻ.getYVelocity();
            if (Math.max(Math.abs(xVelocity), Math.abs(yVelocity)) >= this.ˊ) {
                this.ॱ.ˋ(this.ˋ, this.ˎ, -xVelocity, -yVelocity);
            }
        }
        ˎ();
    }

    private void ˎ() {
        if (this.ʻ != null) {
            this.ʻ.recycle();
            this.ʻ = null;
        }
    }

    private void ˎ(MotionEvent motionEvent) {
        float ॱ = ॱ(motionEvent);
        float ˊ = ˊ(motionEvent);
        float f = ॱ - this.ˋ;
        float f2 = ˊ - this.ˎ;
        if (!this.ॱॱ) {
            this.ॱॱ = Math.sqrt((double) ((f * f) + (f2 * f2))) >= ((double) this.ˏ);
        }
        if (this.ॱॱ) {
            this.ॱ.ˎ(f, f2);
            this.ˋ = ॱ;
            this.ˎ = ˊ;
            if (this.ʻ != null) {
                this.ʻ.addMovement(motionEvent);
            }
        }
    }

    private void ʻ(MotionEvent motionEvent) {
        this.ʻ = VelocityTracker.obtain();
        if (this.ʻ != null) {
            this.ʻ.addMovement(motionEvent);
        }
        this.ˋ = ॱ(motionEvent);
        this.ˎ = ˊ(motionEvent);
        this.ॱॱ = false;
    }
}
